<?php

namespace App\Admin\Actions;

use Encore\Admin\Actions\RowAction;
use Encore\Admin\Facades\Admin;
use Illuminate\Database\Eloquent\Model;

class Apply extends RowAction
{
    public $name = '审核';

    public function handle(Model $model)
    {
        // $model ...
        $model->update([
            'examine_status'=>1,
            'examine_at'=>date('Y-m-d H:i:s'),
            'examine_user'=>Admin::user()->id,
        ]);
        return $this->response()->success('审核成功')->refresh();
    }

    public function dialog()
    {
        $this->question('确定审核通过吗', '', ['confirmButtonColor' => '#d33']);
    }

}
